$(document).ready(
		function() {
			var contextPath = document.location.pathname;
			var index = contextPath.substr(1).indexOf("/");
			contextPath = contextPath.substr(1, index);
			var basePath = "/" + contextPath;
			var memberId = $("#memberId").val();
			var openClose=0;
			/**定时器定时重新获取短信验证码*/
			var second = 90;
			var time = 1000; 
			var interval; //调度器对象。
			$("#Old_password").attr("ajaxurl","../validatePass.do?memberId=" + memberId);

			var validObject = $("#resetPassInfo").Validform({

				dataType : 'text',
				tiptype : 2,
				type : "POST",
				ajaxPost : true,
				callback : function(data) {
					if (data == 0) {
						alert("修改密码成功，将重新跳转到登陆界面！");
						window.parent.location.href=basePath+"/HRTWEB/login.jsp";
					} else if (data == 1) {

						alert("验证码输入错误");
					} else {
						alert("两次输入密码不一致！");
					}
				},

				tiptype : function(msg, o, cssctl) {

					if (!o.obj.is("form")) {
						var tds = o.obj.text();

						var objtip = o.obj.siblings(".Validform_checktip");
						cssctl(objtip, o.type);
						objtip.text(msg);

					}

				}

			});
			$("#resetPassInfo").delegate(
					'#Old_password',
					'change',
					function() {
						validObject.config({
							ajaxurl : {
								success : function(data, obj) {
									if (data.status == "y") {
										$("#validateBtn").removeAttr(
												"disabled");
									} else {
										$("#validateBtn").attr("disabled",
												"disabled");
									}

								},
								error : function(data, obj) {
									alert("error:" + data + obj);
								}

							}

						});

					});
			
			
			$("#resetPassInfo").delegate(
					"#validateBtn",
					"click",
					function(){
						alert("alert------");
						getMobile();
					})
					
					
			function run(){
				interval = setInterval(fun,time);//去掉引号就对了
				}
			function fun(){
				if(second>=0){
					$("#codeTipeClock").text(second+"秒后重新获取");
					second--;
				}else{
					$("#validateBtn").text("重新获取短信验证码");
					$("#codeTipeClock").text("");
					$("#validateBtn").css("display","block");
					$(".validate").css("display","none");
					$(".hideOrShowdiv").css("display","none");
					clearTimeout(interval);
					second=90;
					}
			}
			
			
			function getMobile(){
				
				var mobile = $("#mobile").val();
				$(".validate").css("display","block");
				$("#validateBtn").css("display","none");
			    var memberId = $("#memberId").val();
			    run();
			    alert("mobile--------->"+mobile);
				alert("memberId--------->"+memberId);
				var saveUrl = "../smsRecord/save.do";
				$.ajax({
							url : saveUrl,
							dataType : 'text',
							data : {
								mobile:mobile,
								memberId:memberId
							},
							cache : false,

							success : function(data) {
								if(data=="success"){
									alert("验证码发送成功！！");
								}
							},
							error : function(html) {
								alert("验证码发送失败！！");
								return;
							}
						});

			}
			
		});
